package kz.pompei.ifacer.model.widgets;

import java.io.PrintStream;
import java.util.UUID;

public class WidgetRadio extends Widget {
  public boolean checked = true;
  public String label = "Радио";
  public Align side = Align.LEFT;
  
  @Override
  protected void printFields(int offset, PrintStream out) {
    String s = space(offset);
    out.println(s + "<checked v=\"" + checked + "\"/>");
    out.println(s + "<side v=\"" + side + "\"/>");
    out.println(s + "<label><![CDATA[" + label + "]]></label>");
  }
  
  public WidgetRadio(UUID uuid) {
    super(uuid);
  }
  
  public WidgetRadio() {}
  
  @Override
  public Widget copy() {
    WidgetRadio ret = new WidgetRadio(uuid);
    assignTo(ret);
    return ret;
  }
  
  @Override
  public void assignTo(Widget widget) {
    checkWidget(widget, getClass());
    super.assignTo(widget);
    WidgetRadio w = (WidgetRadio)widget;
    w.checked = checked;
    w.label = label;
    w.side = side;
  }
}
